<template>
  <view class="demo-container">
    <!-- 基础用法 -->
    <view class="demo-block">
      <view class="demo-block__title">基础用法</view>
      <view class="demo-block__content">
        <fu-segmented v-model="value1" :options="options1" />
      </view>
    </view>
    
    <!-- 自定义颜色 -->
    <view class="demo-block">
      <view class="demo-block__title">自定义颜色</view>
      <view class="demo-block__content">
        <fu-segmented 
          v-model="value2" 
          :options="options2"
          active-color="#ee0a24"
          :font-size="32"
        />
      </view>
    </view>
    
    <!-- 禁用选项 -->
    <view class="demo-block">
      <view class="demo-block__title">禁用选项</view>
      <view class="demo-block__content">
        <fu-segmented v-model="value3" :options="options3" />
      </view>
    </view>
    
    <!-- 自定义内容 -->
    <view class="demo-block">
      <view class="demo-block__title">自定义内容</view>
      <view class="demo-block__content">
        <fu-segmented v-model="value4" :options="options4">
          <template #item="{ item, active }">
            <view class="custom-item">
              <fu-icon :name="item.icon" :color="active ? '#2979ff' : '#999'" />
              <text :class="{ active }">{{ item.text }}</text>
            </view>
          </template>
        </fu-segmented>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      value1: 0,
      value2: 0,
      value3: 0,
      value4: 0,
      
      // 基础用法
      options1: [
        { text: '选项1' },
        { text: '选项2' },
        { text: '选项3' }
      ],
      
      // 自定义颜色
      options2: [
        { text: '选项1' },
        { text: '选项2' },
        { text: '选项3' }
      ],
      
      // 禁用选项
      options3: [
        { text: '选项1' },
        { text: '选项2', disabled: true },
        { text: '选项3' }
      ],
      
      // 自定义内容
      options4: [
        { text: '首页', icon: 'home' },
        { text: '搜索', icon: 'search' },
        { text: '我的', icon: 'user' }
      ]
    }
  }
}
</script>

<style lang="scss" scoped>
.demo-container {
  padding: 20rpx;
}

.demo-block {
  margin-bottom: 30rpx;
  
  &__title {
    margin-bottom: 20rpx;
    font-size: var(--fu-font-size-lg);
    color: var(--fu-text-color);
  }
  
  &__content {
    background: #fff;
    border-radius: var(--fu-radius-base);
    padding: 30rpx;
    display: flex;
    justify-content: center;
  }
}

.custom-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8rpx;
  
  .fu-icon {
    font-size: 40rpx;
  }
  
  text {
    font-size: 24rpx;
    color: #999;
    
    &.active {
      color: var(--fu-primary-color);
    }
  }
}
</style> 